package controy

import (
	"booknote/service"
	"fmt"
	"net/http"
	"strings"
)

func SayhelloName(w http.ResponseWriter, r *http.Request) {
	r.ParseForm()       //解析参数，默认是不会解析的
	fmt.Println(r.Form) //这些信息是输出到服务器端的打印信息
	fmt.Println("path", r.URL.Path)
	fmt.Println("scheme", r.URL.Scheme)
	fmt.Println(r.Form["url_long"])
	for k, v := range r.Form {
		fmt.Println("key:", k)
		fmt.Println("val:", strings.Join(v, ""))
	}
	fmt.Fprintf(w, "---Hello Wrold!---") //这个写入到w的是输出到客户端的
	books := service.Openmysql()
	for _, item := range books {
		fmt.Println("---cojojo", item.BookName, item.Author, item.UserId, item.Summary, "cojojo---")
	}
	fmt.Println("---SayhelloName-books:", books)
	fmt.Fprintf(w, "---Hello Wrold! end---") //这个写入到w的是输出到客户端的
}
